import { createRouter, createWebHistory } from "vue-router";
import { ref } from "vue";
import pageHome from "@/views/home/index.vue";
import myspare from "@/views/myspare/myspare.vue";
import myresume from "@/views/myresume/myresume.vue";
import pkLayout from "@/components/pkui/pklayout/pklayout.vue";
import Login from "@/views/login/index.vue";
import interview from "@/views/interview/index.vue";
import messagecenter from "@/views/messagecenter/index.vue";
import candidatedetails from "@/views/candidatedetails/index.vue";
import interviewcomments from "@/views/interviewcomments/index.vue";
import createJob from "@/views/createJob/createJob.vue";
import myinterview from "@/views/myinterview/index.vue";
import joinInterview from "@/views/joinInterview/index.vue";
import interviewer from "@/views/interviewer/index.vue";
import staffPage from "@/views/staffpage/index.vue";
import myAgentsitem from "@/views/myAgentsitem/index.vue";
import invitation from '@/views/invitation/index.vue'
import { Toast } from "@/utils/vant";
import { getToken, setKeyItem } from "@/utils/auth";
import { getUserInfo } from "@/api/api";
const isToken = ref(false);
const router = createRouter({
  history: createWebHistory("/"),
  routes: [
    {
      path: '/gis',
      component: () => import("@/views/gis/index.vue"),
    },
    // {
    //   path: "/",
    //   redirect: "agents",
    //   component: pkLayout,
    //   children: [
    //     {
    //       path: "/agents",
    //       component: pageHome,
    //       name: "数字分身",
    //     },
    //     {
    //       path: "/interview",
    //       component: interview,
    //       name: "AI面试官",
    //     },
    //     {
    //       path: "/notification",
    //       component: messagecenter,
    //       name: "消息中心",
    //     },
    //     // {
    //     //   path: "/bolePin",
    //     //   children: [
    //     //     {
    //     //       path: "agent/getPageList",
    //     //       component: myspare,
    //     //       name: "我的分身",
    //     //     },
    //     //     {
    //     //       path: "agent/getPublicPageList",
    //     //       component: pageHome,
    //     //       name: "数字分身",
    //     //     },
    //     //   ]
    //     // },
    //     {
    //       path: "/profile",
    //       redirect: "/profile/myAgents",
    //       children: [
    //         {
    //           path: "myAgents",
    //           component: myspare,
    //         },
    //         {
    //           path: "resume",
    //           component: myresume,
    //         },
    //         {
    //           path: "staff",
    //           component: staffPage,
    //         },
    //       ],
    //     },
    //     {
    //       path: "/candidatedetails/:name/:id",
    //       component: candidatedetails,
    //       name: "候选人明细",
    //     },
    //     {
    //       path: "/candidates/report/:id",
    //       component: interviewcomments,
    //       name: "面试评语",
    //     },
    //     {
    //       path: "/myAgentsitem",
    //       component: myAgentsitem,
    //       name: "创建分身",
    //     },
    //     {
    //       path: "/createJob",
    //       component: createJob,
    //       name: "岗位信息",
    //     },
    //     {
    //       path: "/myinterview",
    //       component: myinterview,
    //       name: "我的面试",
    //     },
    //     {
    //       path: "/joinInterview",
    //       component: joinInterview,
    //       name: "面试邀请",
    //     },
    //     {
    //       path: "/interviewer/:name/:id",
    //       component: interviewer,
    //       name: "修改面试官",
    //     },
    //   ],
    // },
    // {
    //   path: '/invitation',
    //   component: invitation,
    // },
    // {
    //   path: "/login",
    //   component: Login,
    // },
  ],
});

// router.beforeEach((to, from, next) => {
//   if (to?.name) {
//     document.title = to.name;
//   }
//   if (getToken() && !isToken.value) {
//     getUserInfo({})
//       .then((res) => {
//         isToken.value = true;
//         next();
//       })
//       .catch((err) => {
//         next();
//       });
//   } else {
//     next();
//   }

// });

export default router;
